import React, { Component,Suspense} from 'react';
import {HashRouter as Router,Route,Switch } from "react-router-dom"
import routes from "./index"
class RouterConfig extends Component {
    render() {
        return (
            <Suspense fallback={<div>.....</div>}>
              <Router>
                <Switch>
                  {/* 
                    <Route path="" render={()=><Cmp></Cmp>}></Route>
                  */}
                  {
                    routes.map(route=>{
                      return <Route 
                      key={route.path}
                      exact={route.exact}
                      path={route.path} render={(props)=><route.component {...props} {...route.routes}></route.component>}></Route>
                    })
                  }
                </Switch>
              </Router>
            </Suspense>
          );
    }
}

export default RouterConfig;
